package com.wjc.homework;

import java.util.Objects;

/**
 * @author wang'ji'cheng
 * @date 2025/7/11
 */
public class HomeWork02 {
    //获取字符串数组中的对应值
    public static void main(String[] args) {
        String [] arr ={"wjc","wzy","lxl"};
        System.out.println(find(arr,"wzy"));
        System.out.println(find(arr,"lxl"));
        System.out.println(find(arr,"lll"));

    }
    public static int find(String [] arr, String target){

        for (int i = 0; i < arr.length; i++) {
            if(target.equals(arr[i])){
                return i;
            }
        }
        return -1;
    }
}
